package com.edu.exam.enums.grading;

import com.edu.exam.enums.core.BaseEnum;

import java.util.Arrays;

/**
 * 交互类型枚举
 * 管理批注系统中的各种交互操作类型
 *
 * @author System
 * @version 1.0.0
 */
public enum InteractionType implements BaseEnum {

    /** 基础交互类型 */
    CLICK("CLICK", "点击"),
    DOUBLE_CLICK("DOUBLE_CLICK", "双击"),
    RIGHT_CLICK("RIGHT_CLICK", "右击"),
    HOVER("HOVER", "悬停"),
    SELECT("SELECT", "选择"),
    DRAG("DRAG", "拖拽"),
    DROP("DROP", "放置"),

    /** 编辑交互类型 */
    INPUT("INPUT", "输入"),
    EDIT("EDIT", "编辑"),
    DELETE("DELETE", "删除"),
    COPY("COPY", "复制"),
    PASTE("PASTE", "粘贴"),
    UNDO("UNDO", "撤销"),
    REDO("REDO", "重做"),

    /** 批注交互类型 */
    ANNOTATE("ANNOTATE", "批注"),
    COMMENT("COMMENT", "评论"),
    HIGHLIGHT("HIGHLIGHT", "高亮"),
    MARK("MARK", "标记"),
    NOTE("NOTE", "备注"),
    DRAW("DRAW", "绘制"),
    ERASE("ERASE", "擦除"),

    /** 导航交互类型 */
    ZOOM_IN("ZOOM_IN", "放大"),
    ZOOM_OUT("ZOOM_OUT", "缩小"),
    PAN("PAN", "平移"),
    ROTATE("ROTATE", "旋转"),
    FIT("FIT", "适应"),
    SCROLL("SCROLL", "滚动");

    private final String code;
    private final String description;

    InteractionType(String code, String description) {
        this.code = code;
        this.description = description;
    }

    @Override
    public String getCode() {
        return code;
    }

    @Override
    public String getDescription() {
        return description;
    }

    public static InteractionType fromCode(String code) {
        return Arrays.stream(values())
                .filter(e -> e.getCode().equals(code))
                .findFirst()
                .orElseThrow(() -> new IllegalArgumentException("Unknown interaction type code: " + code));
    }
    @Override
    public String toString() {
        return description;
    }
}